<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel app\models\search\AuthShoptSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '店铺管理';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="auth-shop-index">
    <p>
        <?= Html::a('授权添加店铺', ['auth-app/index'], ['class' => 'btn btn-success']) ?>
        <?= Html::a('手动添加店铺', ['create'], ['class' => 'btn btn-success']) ?>
    </p>

    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            [
                'attribute'=>'id',
                'options' => ['width' => '100px'],
//                'filter'=>false,
                'value'=>function($model){
                    return $model->id;
                }
            ],
            [
                'attribute'=>'auth_app_id',
                'options' => ['width' => '60px'],
                'filter'=>\app\models\AuthApp::getOptions(),
                'format'=>'raw',
                'value'=>function($model){
                    return Html::a($model->authApp->showLogo(),['index','AuthAccountSearch[auth_app_id]'=>$model->auth_app_id]);
                }
            ],
            'auth_app_shop_id',
            'name',
            'note_name',
            //'avatar',
            //'token',
            //'token_expire_time:datetime',
            //'refresh_token',
            //'refresh_token_expire_time:datetime',
            //'ctime:datetime',
            'state',
            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>


</div>
